<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button onclick="notifyMe()">Notify me!</button>
		<script>
			function notifyMe() {
			  if (!("Notification" in window)) {
			    // Check if the browser supports notifications
			    alert("该浏览器不支持桌面通知");
			  } else if (Notification.permission === "granted") {
			    // Check whether notification permissions have already been granted;
			    // if so, create a notification
			    const notification = new Notification("Hi there!");
			    // …
			  } else if (Notification.permission !== "denied") {
			    // We need to ask the user for permission
			    Notification.requestPermission().then((permission) => {
			      // If the user accepts, let's create a notification
			      if (permission === "granted") {
			        const notification = new Notification("Hi there!");
			        // …
			      }
			    });
			  }
			
			  // At last, if the user has denied notifications, and you
			  // want to be respectful there is no need to bother them anymore.
			}

		</script>
	</body>
</html>